package io.github.enbool.domain;

import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=true)
@MappedSuperclass
public abstract class AbstractUser extends AbstractEntity implements UserDetails {

	private static final long serialVersionUID = 1L;

	@Column(name = "is_enabled")
	private Boolean enabled;
	
	private String avatarUrl;
	private String nickName;
	private String gender;
	private String language;
	private String city;
	private String province;
	private String country;
	
	private String password;
	
	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isAccountNonExpired() {
		
		return true;
	}

	@Override
	public boolean isAccountNonLocked() {
		
		return enabled;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		
		return true;
	}

	@Override
	public boolean isEnabled() {		
		return enabled;
	}
}
